#include<iostream>
#include<cstdio>
#define N 200000
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int n,m,q,a[N+1];
int main()
{
	freopen("lodge.in","r",stdin);
	freopen("lodge.out","w",stdout);
	int k,p,x,y;
	n=read(),m=read(),q=read();
	for (int i=1;i<=m;++i) x=read(),y=read();
	while (q--)
	{
		k=read(),p=read();
		for (int i=1;i<=p;++i) a[i]=read();
		printf("%d\n",k);
	}
	return 0;
}
